function Stack() {
  this.items = []
  Stack.prototype.push = (element) => {
    this.items.push(element)
  }
  Stack.prototype.pop = (element) => {
    return this.items.pop(element)
  }
  Stack.prototype.peek = () => {
    return this.items[this.items.length - 1]
  }
  Stack.prototype.isEmpty = () => {
    return this.items.length == 0
  }
  Stack.prototype.size = () => {
    return this.items.length
  }
  Stack.prototype.toString = () => {
    let resultString = ''
    for (let i = 0; i < this.items.length; i++) {
      resultString += this.items[i] + ' '
    }
    return resultString
  }
}

let stack = new Stack()
stack.push(1)
stack.push(2)
stack.push(3)
stack.push(4)
stack.push(5)
stack.push(6)
stack.peek()
stack.pop()
stack.size()
stack.isEmpty()
stack.toString()